$(".carousel-inner>.carousel-item:first-child").addClass("active");
//轮播图2初始化
$('#demo1').carousel();
//倒计时
var preDate_1 = '2021-10-17';//自考
var preDate_2 = '2021-10-17';//远程教育
var preDate_3 = '2021-10-17';//国开

diff(preDate_1,'zk');
diff(preDate_2,'yc');
diff(preDate_3,'gk');

function diff(time,className){
    var preDate = new Date(time).getTime();
    var today = new Date().getTime();
    var arr = [0,0,0];
    if(preDate>today){
        var dif =Math.ceil((preDate - today)/1000/3600/24).toString();
        arr = dif.split('');
        if(arr.length<3){
            var tem = [].concat(arr);
            var i = 0;
            for(i=0; i<(3-tem.length);i++){
                arr.unshift('0');
            }
        }
    }
    for(var index in arr){
        $("."+className+"_"+(parseInt(index)+1)).html(arr[index]);
    }
}